

var session=request.getSession();
if(typeof session==='undefined'){


	response.redirect("/login",request,response);
	response.end();

}else if(session.LoggedIn){


	request.user={
			username:session.user["username"],
			name:session.user["name"],
			picture:session.user["picture"]
				
		};
	//get boards from DB
		
	var boardController=request.require("./boardController");
	boardController.queryBoardsfromUser(request.user.username,request,response,cb);

	

	

	
}else{
	response.redirect("/login",request,response);
	response.end();

}


function cb(boards,request,response){

	request.setAttribute("boards",boards);

	var boardController=request.require("./boardController");
	boardController.queryCategorys(response,queryCb);


	
}


function queryCb(categorys,response){

	request.setAttribute("categorys",categorys);
	response.forward("/home/home.jst",request,response);
	response.end();

}